package com.jierui.meter.frontend.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

/**
 * 异常编码Enum
 */
@Getter
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum MeterStatusEnum {
    NORMAL(1, "正常"),
    EXCEPTION(2, "异常"),
    TEST(3, "观察"),
    ;


    private int value;
    private String name;

    public int getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

    MeterStatusEnum(int value, String name) {
        this.value=value;
        this.name=name;
    }

    public static String getName(int index) {
        for (MeterStatusEnum c : MeterStatusEnum.values()) {
            if (c.getValue() == index) {
                return c.name;
            }
        }
        return null;
    }
}
